package com.tomcov.client;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.tomcov.client.activities.HeaderActivity;
import com.tomcov.client.place.MapPlace;
import com.tomcov.client.place.MessageInPlace;
import com.tomcov.client.place.MessageOutPlace;
import com.tomcov.client.place.MyJourneyPlace;
import com.tomcov.client.place.NewMessagePlace;
import com.tomcov.client.place.SettingsPlace;

public class HeaderAppActivityMapper implements ActivityMapper {
	
	/** The client factory. */
	private ClientFactory clientFactory;

	/**
	 * Instantiates a new header app activity mapper.
	 *
	 * @param clientFactory the client factory
	 */
	public HeaderAppActivityMapper(ClientFactory clientFactory) {
		//super();
		this.clientFactory = clientFactory;
	}

	/* (non-Javadoc)
	 * @see com.google.gwt.activity.shared.ActivityMapper#getActivity(com.google.gwt.place.shared.Place)
	 */
	@Override
	public Activity getActivity(Place place) {
		if (place instanceof MapPlace)
			return new HeaderActivity(clientFactory);
		else if (place instanceof MessageOutPlace)
			return new HeaderActivity(clientFactory);
		else if (place instanceof MessageInPlace)
			return new HeaderActivity(clientFactory);
		else if (place instanceof SettingsPlace)
			return new HeaderActivity(clientFactory);
		else if (place instanceof NewMessagePlace)
			return new HeaderActivity(clientFactory);
		else if (place instanceof MyJourneyPlace)
			return new HeaderActivity(clientFactory);
		return null;
	}
}
